import glob
import os
import numpy
import tqdm
import shutil


def select321():
    i =0
    path = "/home/jiayu/Desktop/Jimmy/1219(分六组)/601-1219_all_nerve/gt3"
    img_train = "/home/jiayu/Desktop/Jimmy/1219(分六组)/601-1219_all_nerve/train/gt3"
    img_test = "/home/jiayu/Desktop/Jimmy/1219(分六组)/601-1219_all_nerve/test/gt3"
    img_val = "/home/jiayu/Desktop/Jimmy/1219(分六组)/601-1219_all_nerve/val/gt3"
    for file in tqdm.tqdm(glob.glob(os.path.join(path, "*"))):
        base_name = os.path.basename(file)
        if i % 5 == 0 or i % 5 == 2 or i % 5 == 4:
            save_train = os.path.join(img_train, base_name + ".png")
            shutil.copyfile(src=file, dst=save_train)
        if i % 5 == 1:
            save_test = os.path.join(img_test, base_name + ".png")
            shutil.copyfile(src=file, dst=save_test)
        if i % 5 == 3:
            save_val = os.path.join(img_val, base_name + ".png")
            shutil.copyfile(src=file, dst=save_val)
        i +=1


if __name__ == '__main__':
    select321()


